<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet"
          integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">

    <!-- Option 1: Bootstrap Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js"
            integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW"
            crossorigin="anonymous"></script>

    <!--    <link href="css/main.css" rel="stylesheet">-->
    <link href="css/product.css" rel="stylesheet">


    <title>奶茶店后台</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light shadow-sm">
    <div class="container-fluid">
        <a class="navbar-brand" href="/main.html">奶茶店后台</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
                aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav">
                <li class="nav-item">
                    <a class="nav-link" href="/order.html">订单管理</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/users.html">用户管理</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/product.html">商品管理</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/productSort.html">商品分类管理</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link active" aria-current="page" href="/activity.html">活动管理</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/userInfo.html">个人中心</a>
                </li>
            </ul>
        </div>
    </div>
</nav>
<div class="d-flex flex-column align-items-center">
    <div class="alert alert-danger position-absolute w-25 text-center" role="alert" id="alert"
         style="top: 100px; z-index: 1055;" hidden>
    </div>


    <div class="title-holder w-75 mt-lg-3 mb-lg-4 p-lg-5">
        <h1>活动详情</h1>
    </div>

    <div class="d-flex flex-row align-items-baseline">
        <button type="button" class="btn btn-outline-primary me-lg-5" data-bs-toggle="modal"
                data-bs-target="#exampleModal" data-bs-index="-1">新建活动
        </button>


        <div class="d-flex flex-row align-items-baseline">
            <select class="form-select mb-lg-3 me-3" aria-label="Default select example">
                <option value="1">批量删除</option>
            </select>
            <button type="button" class="btn btn-outline-primary" onclick="actDelete()">确认</button>
        </div>
    </div>


    <table class="table table-striped w-75">
        <thead>
        <tr>
            <th scope="col">#</th>
            <th scope="col" style="width: 100px">活动编号</th>
            <th scope="col">活动名</th>
            <th scope="col">折扣</th>
            <th scope="col">顺序</th>
            <th scope="col">状态</th>
            <th scope="col" style="width: 300px">活动操作</th>
        </tr>
        </thead>
        <tbody id="table-body">
        <tr>
            <td>
                <div class="form-check">
                    <input class="form-check-input delete-check" type="checkbox" value="">
                </div>
            </td>
            <th scope="row">1</th>
            <td>
                <label class="w-50">
                    <input type="text" class="form-control" placeholder="Otto">
                </label>
            </td>
            <td>
                <label class="w-50">
                    <input type="text" class="form-control" placeholder="Otto">
                </label>
            </td>
            <td>
                <label class="w-50">
                    <input type="text" class="form-control" placeholder="Otto">
                </label>
            </td>
            <td class="d-flex flex-row align-items-baseline mb-0">
                <button type="button" class="btn btn-info me-3 pt-sm-1 pb-sm-1 w-2" data-bs-toggle="modal"
                        data-bs-target="#exampleModal">查看详情
                </button>
                <button type="button" class="btn btn-primary me-3">修改</button>
                <button type="button" class="btn btn-danger">删除</button>
            </td>
        </tr>
        <tr>
            <td>
                <div class="form-check">
                    <input class="form-check-input" type="checkbox" value="">
                </div>
            </td>
            <th scope="row">1</th>
            <td>
                <label class="w-50">
                    <input type="text" class="form-control" placeholder="Otto">
                </label>
            </td>
            <td>
                <label class="w-50">
                    <input type="text" class="form-control" placeholder="Otto">
                </label>
            </td>
            <td>
                <label class="w-50">
                    <input type="text" class="form-control" placeholder="Otto">
                </label>
            </td>
            <td class="d-flex flex-row align-items-baseline mb-0">
                <button type="button" class="btn btn-info me-3 pt-sm-1 pb-sm-1 w-2" data-bs-toggle="modal"
                        data-bs-target="#exampleModal">查看详情
                </button>
                <button type="button" class="btn btn-primary me-3">修改</button>
                <button type="button" class="btn btn-danger">删除</button>
            </td>
        </tr>
        <tr>
            <td>
                <div class="form-check">
                    <input class="form-check-input" type="checkbox" value="">
                </div>
            </td>
            <th scope="row">1</th>
            <td>
                <label class="w-50">
                    <input type="text" class="form-control" placeholder="Otto">
                </label>
            </td>
            <td>
                <label class="w-50">
                    <input type="text" class="form-control" placeholder="Otto">
                </label>
            </td>
            <td>
                <label class="w-50">
                    <input type="text" class="form-control" placeholder="Otto">
                </label>
            </td>
            <td class="d-flex flex-row align-items-baseline mb-0">
                <button type="button" class="btn btn-info me-3 pt-sm-1 pb-sm-1 w-2" data-bs-toggle="modal"
                        data-bs-target="#exampleModal">查看详情
                </button>
                <button type="button" class="btn btn-primary me-3">修改</button>
                <button type="button" class="btn btn-danger">删除</button>
            </td>
        </tr>
        </tbody>
    </table>
</div>

<div class="modal fade modal-dialog-scrollable" tabindex="-1" id="exampleModal" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">订单详情</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body d-flex flex-column align-items-center">
                <div class="modal-body d-flex flex-column align-items-center p-lg-5">
                    <img class="avatar-preview shadow-sm mb-5" src="img/camera.png" width="260" height="130"
                         id="preview" style="object-fit: contain">

                    <div class="input-group mb-3">
                        <label class="input-group-text" for="inputFile">上传</label>
                        <input type="file" class="form-control" id="inputFile">
                    </div>
                </div>

                <div class="input-group mb-3">
                    <span class="input-group-text w-25">活动名</span>
                    <input type="text" class="form-control p-md-2" value="" id="actName">
                </div>
                <div class="input-group mb-3">
                    <span class="input-group-text w-25">活动折扣</span>
                    <input type="text" class="form-control p-md-2" value="" id="disCount">
                </div>
                <div class="input-group mb-3">
                    <span class="input-group-text w-25">展示顺序</span>
                    <input type="text" class="form-control p-md-2" value="" id="displayOrder">
                </div>
                <div class="input-group mb-3">
                    <div class="input-group mb-3 d-flex flex-row align-items-center justify-content-center">
                        <span class="input-group-text me-4">启用</span>
                        <div class="form-check form-switch ">
                            <input class="form-check-input" type="checkbox" id="status" onchange="genDisplayOrder()">
                        </div>
                    </div>
                </div>


                <div class="accordion w-100 mb-3" id="accordionExample">
                    <div class="accordion-item">
                        <h2 class="accordion-header" id="headingOne">
                            <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
                                    data-bs-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne">
                                商品 #1
                            </button>
                        </h2>
                        <div id="collapseOne" class="accordion-collapse collapse" aria-labelledby="headingOne"
                             data-bs-parent="#accordionExample">
                            <div class="accordion-body">
                                <ul class="list-group">
                                    <li class="list-group-item d-flex flex-row">
                                        <div class="w-50">
                                            商品名:
                                        </div>
                                        <div class="flex-grow-1" content="product-id">
                                            商品名
                                        </div>
                                    </li>
                                    <li class="list-group-item d-flex flex-row">
                                        <div class="w-50">
                                            规格:
                                        </div>
                                        <div class="flex-grow-1">
                                            商品名
                                        </div>
                                    </li>
                                    <li class="list-group-item d-flex flex-row">
                                        <div class="w-50">
                                            加料:
                                        </div>
                                        <div class="flex-grow-1">
                                            商品名
                                        </div>
                                    </li>
                                    <li class="list-group-item d-flex flex-row">
                                        <div class="w-50">
                                            折扣:
                                        </div>
                                        <div class="flex-grow-1">
                                            100%
                                        </div>
                                    </li>
                                    <li class="list-group-item d-flex flex-row">
                                        <div class="w-50">
                                            实际价格:
                                        </div>
                                        <div class="flex-grow-1">
                                            商品名
                                        </div>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="d-flex flex-row align-items-baseline">
                    <select class="form-select mb-lg-3 me-3" aria-label="Default select example"
                            id="product-add-selector">
                        <option value="1">商品 #1</option>
                        <option value="2">商品 #2</option>
                    </select>
                    <button type="button" class="btn btn-outline-primary" id="product-add">添加</button>
                </div>
            </div>


            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" data-bs-dismiss="modal" id="save">保存</button>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="actEditModal" tabindex="-1" aria-labelledby="actEditModal" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">Modal title</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                ...
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary">Save changes</button>
            </div>
        </div>
    </div>
</div>

<script src="js/general.js"></script>
<script src="js/activity.js"></script>
<script>
    getProducts();
    initActivities();
    initModal();
</script>
</body>
</html>
